//
//  NewsModel.m
//  NeteaseNews
//
//  Created by dllo on 15/11/23.
//  Copyright (c) 2015年 郑举廷. All rights reserved.
//

#import "NewsModel.h"

@implementation NewsModel

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"ads"]) {
        NSArray *array = value;
        NSMutableArray *mutableArray = [[NSMutableArray alloc] init];
        for (NSDictionary *dic in array) {
            NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:[dic valueForKey:@"imgsrc"], @"imgsrc", [dic valueForKey:@"title"], @"title", nil];
            [mutableArray addObject:dictionary];
        }
        self.scrollArray = [[NSArray alloc] initWithArray:mutableArray];
    }
}

- (id)valueForUndefinedKey:(NSString *)key {
    return nil;
}

- (instancetype)initWithDicitionary:(NSDictionary *)data
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:data];
    }
    return self;
}








@end
